package day8.pack1;

import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        Pet pet = null;
        Scanner input = new Scanner(System.in);
        System.out.println("欢迎您来到宠物店");
        System.out.print("请输入要领养宠物的名字:");
        String nickname = input.next();
        System.out.print("请选择要领养的宠物类型:(1. 狗狗 2. 企鹅)");
        int choose = input.nextInt();
        if (choose == 1) {
            System.out.print("请选择狗的品种(1. " + Dog.LBLD + " 2. " + Dog.XNR + "):");
            int dogType = input.nextInt();
            String type = (dogType == 1 ? Dog.LBLD : Dog.XNR);
            System.out.print("请输入狗狗的健康值(1到100之间):");
            pet = new Dog(nickname, input.nextInt(), type);
        }
        if (choose == 2) {
            System.out.print("请选择企鹅的性别(1. " + Penguin.Q_BOY + " 2. " + Penguin.Q_GIRL + "):");
            int penguinGender = input.nextInt();
            String gender = (penguinGender == 1 ? Penguin.Q_BOY : Penguin.Q_GIRL);
            System.out.print("请输入企鹅的健康值(1到100之间):");
            pet = new Penguin(nickname, input.nextInt(), gender);
        }
        System.out.println("宠物的自白:");
        // 多态,自动通过pet的引用,调用对应的对象的print方法
        pet.print();
        Master master = new Master();
        master.player(pet);
        master.feed(pet);

    }
}
